package com.itlong.cloud.user.property;


import com.itlong.cloud.POJO.DTO.property.PropertyUserInfoGetPageDTO;
import com.itlong.cloud.POJO.DTO.property.PropertyUserLoginDTO;
import com.itlong.cloud.POJO.DTO.property.PropertyUserSaveDTO;
import com.itlong.cloud.POJO.PO.PropertyUserInfoPO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.VO.property.*;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 *     物业人员服务处理暴露接口
 * </desc>
 *
 * @createDate 2017/10/13
 */
@FeignClient(name = "user-service")
public interface IPropertyUserServiceClient {


    /**
     * <desc>
     *      物业用户登录时校验用户
     * <desc/>
     * @param   propertyUserInfoPO  登录成功的物业人员信息
     * @return  PropertyUserLoginCheckVO  物业登录校验DTO
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/user/getLoginDetail")
    PropertyUserLoginCheckVO getLoginDetail(@RequestBody PropertyUserInfoPO propertyUserInfoPO) throws UnsupportedEncodingException;

    /**
     * <desc>
     *      物业注销
     * <desc/>
     * @param   propertyUserLoginDTO    物业登出校验DTO
     * @return
     * @author Biao.R
     * @createDate 2017/10/16
     */
    @PostMapping(path = "/property/user/logout")
    PropertyUserCacheVO logout(@RequestBody PropertyUserLoginDTO propertyUserLoginDTO);

    /**
     * <desc>
     *      物业用户请求时校验通过token校验用户
     * <desc/>
     * @param   loginUserId  登录用户ID
     * @param   token  登录用户ID
     * @return  PropertyUserLoginCheckVO  物业登录校验DTO
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/user/checkCacheUser")
    PropertyUserCacheVO checkCacheUser(@RequestParam("loginUserId") String loginUserId,
                                       @RequestParam("token") String token);

    /**
     * <desc>
     *      获取分页数据
     * </desc>
     *
     * @param pageDTO   参数DTO
     * @return  分页模型
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/getPage")
     Page<PropertyUserInfoGetUserPageVO> getPage(@RequestBody PropertyUserInfoGetPageDTO pageDTO);


    /**
     * <desc>
     *      修改密码
     * </desc>
     *
     * @param userName 用户名
     * @param password 密码
     * @param newPassword 新密码
     * @return
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/updatePassword")
     Integer updatePassword(
            @RequestParam("userName")String userName,@RequestParam("password")String password,@RequestParam("newPassword")String newPassword) throws Exception;

    /**
     * <desc>
     *      保存人员
     * </desc>
     *
     * @param propertyUserInfoPO 人员实体
     * @return sql执行行数
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/save")
     Integer save(@RequestBody PropertyUserSaveDTO propertyUserInfoPO) throws Exception;

    /**
     * <desc>
     *      更新人员
     * </desc>
     *
     * @param propertyUserInfoPO 人员实体
     * @return sql执行行数
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/update")
     Integer update(@RequestBody PropertyUserSaveDTO propertyUserInfoPO) throws Exception;

    /**
     * <desc>
     *      根据条件查询人员
     * </desc>
     * @param    params  查询参数
     * @return  List<PropertyUserInfoPO> 人员实体集合
     * @author Biao.R
     * @createDate 2017/10/13
     *
     */
    @PostMapping(path = "/property/system/user/getList")
     List<PropertyUserInfoPO> getList(@RequestBody Map<String, Object> params);


    /**
     * <desc>
     *      根据id查询人员VO
     * </desc>
     *
     * @param propertyUserInfoPO 人员实体
     * @return  人员管理查看人员VO类
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/getOneVO")
    PropertyUserInfoGetOneVO getOneVO(@RequestBody PropertyUserInfoPO propertyUserInfoPO);

    /**
     * <desc>
     *      删除用户
     * </desc>
     *
     * @param userIds   用户id 多个用,号分隔
     * @return
     * @author Biao.R
     * @createDate 2017/10/13
     */
    @PostMapping(path = "/property/system/user/delete")
     Integer delete(@RequestParam("userIds") String userIds);


    /**
     * <desc>
     *      批量重置密码
     * <desc/>
     * @param  userIds  用户ID,多个以，分隔
     * @author Biao.R
     * @createDate 2017/11/8
     */
    @PostMapping(path = "/property/system/user/resetPassword")
    void resetPassword(@RequestParam("userIds") String userIds);

    /**
     * <desc>
     *      更新property_user_info单表
     * <desc/>
     * @param   userInfoPO   待更新对象
     * @return 更新数量
     * @author Biao.R
     * @createDate 2017/11/13
     */
    @PostMapping(path = "/property/system/user/updateUser")
    Integer updateUser(@RequestBody PropertyUserInfoPO userInfoPO);

    /**
     * <desc>
     *      根据项目编号和项目物业管理员密码校验登录用户
     * <desc/>
     * @param  param    校验参数
     * @return  查询到的用户信息
     * @author Biao.R
     * @createDate 2017/12/10
     */
    @PostMapping(path = "/property/system/user/checkUserByProjectId")
    PropertyUserInfoPO checkUserByProjectId(@RequestBody Map<String, Object> param);

    /**
     * <desc>
     *      根据物业帐号和密码校验登录用户
     * <desc/>
     * @param  param    校验参数
     * @return  查询到的用户信息
     * @author Biao.R
     * @createDate 2017/12/10
     */
    @PostMapping(path = "/property/system/user/checkUserByUserName")
    PropertyUserInfoPO checkUserByUserName(@RequestBody Map<String, String> param);

    /**
     * <desc>
     *      查询物业用户所属项目信息
     * <desc/>
     * @param  userId   待查询用户userId
     * @return 查询到的项目状态信息
     * @author Biao.R
     * @createDate 2017/12/11
     */
    @PostMapping(path = "/property/system/user/getProjectByUserId")
    List<Integer> getProjectByUserId(@RequestParam("userId") String userId);

    /**
     * <desc>
     *      物业登陆错误处理
     * <desc/>
     * @param   propertyUserLoginDTO    登录用户DTO
     * @return  标准化响应结果
     * @author Biao.R
     * @createDate 2017/12/15
     */
    @PostMapping(path = "/property/system/user/loginErrorHandler")
    MessageVO loginErrorHandler(@RequestBody PropertyUserLoginDTO propertyUserLoginDTO);

    /**
     * <desc>
     *      检查账号是否被锁定
     * <desc/>
     * @param  account  检查的账号
     * @return  标准化响应结果
     * @author Biao.R
     * @createDate 2017/12/15
     */
    @PostMapping(path = "/property/system/user/getAccountLockDetail")
    MessageVO getAccountLockDetail(@RequestParam("account") String account);

    /**
     * <desc>
     *      根据条件查询人员是否存在 1-存在  0-不存在
     * </desc>
     * @param    params  查询参数
     * @return  List<PropertyUserInfoPO> 人员实体集合
     * @author Biao.R
     * @createDate 2017/10/13
     *
     */
    @PostMapping(path = "/property/system/user/isPropertyUserExist")
    boolean isPropertyUserExist(@RequestBody Map<String, Object> params);

    /**
     * <desc>
     *      根据电梯cardId查询userId
     * </desc>
     *
     * @param cardId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/25
     */
    @PostMapping(path = "/property/system/user/getUserIdByCardId")
    public String getUserIdByCardId(@RequestParam("cardId") String cardId);

    /**
     * <desc>
     *     登录成功后根据userid查询当前用户下的小区信息
     * <desc/>
     *@param loginUserId
     * @return  MessageVO 标准格式化响应结果
     * @author JuGuang.S
     * @createDate 2018/07/04
     */
    @PostMapping(path = "/property/user/getUserProjectInfo")
    List<PropertyProjectRoleVO> getUserProjectInfo(@RequestParam("loginUserId") String loginUserId) throws Exception;

    /**
     * <desc>
     *      由项目id查询物业名称
     * </desc>
     *
     * @param projectId 项目id
     * @return 物业名称
     * @author wangzhi
     * @createDate 2018/08/31
     */
    @PostMapping(path = "/property/user/getPropertyNameByProjectId")
    String getPropertyNameByProjectId(@RequestParam("projectId") String projectId) throws Exception;

    /**
     * <desc>
     *      由身份证序列号查询用户信息
     * </desc>
     *
     * @param idCardKey 身份证序列号
     * @return 用户信息
     * @author wangzhi
     * @createDate 2019/02/28
     */
    @PostMapping(path = "/property/user/getUserInfoByIdCardKey")
    Map<String,Object> getUserInfoByIdCardKey(@RequestParam("idCardKey") String idCardKey,@RequestParam("projectId") String projectId) throws Exception;

    /**
     * <desc>
     *      找回密码时，通过账号获取绑定手机号
     * <desc/>
     *
     * @return 相关参数
     * @author wangzhi
     * @createDate 2019/12/25
     */
    @PostMapping(path = "/property/user/getPhoneNumByUserName")
    Map<String,Object> getPhoneNumByUserName(@RequestParam("userName") String userName) throws Exception;

    /**
     * <desc>
     *      根据用户id查询一个用户
     * <desc/>
     * @param  userId    用户id
     * @return  PropertyUserInfoPO
     * @author zhouchun
     * @createDate 2021-05-31
     */
    @PostMapping(path = "/property/system/user/getByUserId")
    PropertyUserInfoPO getByUserId(@RequestParam("userId") String userId);

}
